
#include "util.hpp"

static const std::string    IPV4_OPT = "A.B.C.D";
static const std::string    IPV4_OPT_PREFIX = "A.B.C.D/M";
static const std::string    IPV6_OPT = "X:X:X:X";
static const std::string    HEX_OPT = "0x";

void print_string(std::string& str)
{
    PDBG("%s\n", str.c_str());
    //std::cout << str << "\n";
}

bool is_string(const std::string& str) 
{
    if (str[0] >= 'A' && str[0] <= 'Z')
        return true;
    return false;
}

bool is_ipv4(const std::string& str)
{
    if (IPV4_OPT.compare(str) == 0) return true;
    return false;
}

bool is_ipv4_prefix(const std::string& str)
{
    if (IPV4_OPT_PREFIX.compare(str) == 0) return true;
    return false;
}

bool is_int_range(const std::string& str)
{
    if (is_hex_range(str)) return false;
    if ((str[0] == '<' ) && (str[1] >= '0' || str[1] <= '9')) return true;
    return false;
}

bool is_hex_range(const std::string& str)
{
    if (str[0] == '<' && (str.compare(1, 2, HEX_OPT) == 0)) return true;
    return false;
}

bool is_multi_opt(const std::string& str)
{
    if (str[0] == '(') return true;
    return false;
}


